package com.kun.portal.webframe.po;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.kun.portal.webframe.util.Loaded;
import com.kun.portal.webframe.util.Status;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;

/**
 * Created by Administrator on 2018/5/7.
 */
@Entity
@Table(
        name = "fbo_flight_Plane"
)
@JsonSerialize
@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})

public class FlightPlanePo implements Serializable {
    public String getPlaneId() {
        return planeId;
    }

    public void setPlaneId(String planeId) {
        this.planeId = planeId;
    }

    public FlightInfoPo getFlightInfo() {
        return flightInfo;
    }

    public void setFlightInfo(FlightInfoPo flightInfo) {
        this.flightInfo = flightInfo;
    }

    public Date getExpectDate() {
        return expectDate;
    }

    public void setExpectDate(Date expectDate) {
        this.expectDate = expectDate;
    }

    public String getImportOrExport() {
        return importOrExport;
    }

    public void setImportOrExport(String importOrExport) {
        this.importOrExport = importOrExport;
    }

    public String getOriginating() {
        return originating;
    }

    public void setOriginating(String originating) {
        this.originating = originating;
    }

    public String getDestination() {
        return destination;
    }

    public void setDestination(String destination) {
        this.destination = destination;
    }
    @JsonFormat(pattern="yyyy-MM-dd HH:mm",timezone="Asia/Shanghai")
    public Date getTakeOffTime() {
        return takeOffTime;
    }

    public void setTakeOffTime(Date takeOffTime) {
        this.takeOffTime = takeOffTime;
    }

    @JsonFormat(pattern="yyyy-MM-dd HH:mm",timezone="Asia/Shanghai")
    public Date getArriveTime() {
        return arriveTime;
    }

    public void setArriveTime(Date arriveTime) {
        this.arriveTime = arriveTime;
    }

    @Id
    @GeneratedValue(
            generator = "plane_id"
    )

    @GenericGenerator(
            name = "plane_id",
            strategy = "uuid"
    )
    @Column(
            name = "plane_id",
            length = 32,
            nullable = false
    )

    private String planeId;

    @Column(
            name = "plane_run_status"

    )
    private Integer  planeRunStatus = Status.NEW;
    @OneToOne(targetEntity =FlightInfoPo.class,cascade = CascadeType.DETACH)
    @JoinColumn(name = "flight_info_id",referencedColumnName = "flight_info_id")
    private FlightInfoPo flightInfo;

    @OneToOne(targetEntity =IndustryLoadPo.class,cascade = CascadeType.DETACH ,fetch = FetchType.LAZY)
    @JoinColumn(name = "industry_load_id",referencedColumnName = "industry_load_id")
    private IndustryLoadPo industryLoadPo;//关联飞机配载表

    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "gp_id", referencedColumnName = "gp_id",insertable = true,updatable = true)
    @JsonProperty(access = JsonProperty.Access.READ_WRITE)
    private GpConfigPo gpConfigPo;//关联机位分配

    public GpConfigPo getGpConfigPo() {
        return (GpConfigPo) Loaded.loaded(gpConfigPo);
    }

    public void setGpConfigPo(GpConfigPo gpConfigPo) {
        this.gpConfigPo = gpConfigPo;
    }

    public IndustryLoadPo getIndustryLoadPo() {
        return (IndustryLoadPo) Loaded.loaded(industryLoadPo);
    }

    public void setIndustryLoadPo(IndustryLoadPo industryLoadPo) {
        this.industryLoadPo = industryLoadPo;
    }

    @Column(
            name = "expect_date"
    )
    @Temporal(TemporalType.DATE)
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="Asia/Shanghai")
    private Date expectDate;//预约日期

    @Column(
            name = "import_or_export",
            length = 30
    )
    private String importOrExport;//进出港

    @Column(
            name = "plane_status",
            length = 30
    )
    private String planeStatus;//  状态 取消 cancel  创建 created    完成: compleated  发布：release

    @Column(
            name = "originating",
            length = 30
    )
    private String originating;//出发地

    @Column(
            name = "destination",
            length = 30
    )

    private String destination;//到达地

    @Column(
            name = "take_off_time"
    )
    @DateTimeFormat(pattern="yyyy-MM-dd HH-mm")
    private Date takeOffTime;//起飞时间

    @OneToMany(targetEntity=CourseNodePo.class, cascade = CascadeType.DETACH, fetch = FetchType.LAZY,mappedBy="flightPlanePo")
    private  Set<CourseNodePo> courseNodePos;

    @Column(
            name = "arrive_time"
    )
    @DateTimeFormat(pattern="yyyy-MM-dd HH-mm")
    private Date arriveTime;//到达时间

    @Column(
            name = "process_status"
    )
    private  Integer processStatus = Status.PROCESS_INIT;

    @Column(
            name = "template_plane"
    )
    private Boolean templatePlane;//预计到达时间

    public String getPlaneStatus() {
        return planeStatus;
    }

    public void setPlaneStatus(String planeStatus) {
        this.planeStatus = planeStatus;
    }

    //2018-07-23添加字段——lc
    @Column(
            name = "air_route_nature",
            length = 30
    )
    private String airRouteNature="正常";//航线性质
    @Column(
            name = "transit",
            length = 30
    )
    private String transit;//经停
    @Column(
            name = "pre_fly_time",
            length = 30
    )
    @DateTimeFormat(pattern="yyyy-MM-dd HH-mm")
    private Date preFlyTime;//预飞
    @Column(
            name = "real_fly_time",
            length = 30
    )
    @DateTimeFormat(pattern="yyyy-MM-dd HH-mm")
    private Date realFlyTime;//实飞
    @Column(
            name = "pre_arrive_time",
            length = 30
    )
    @DateTimeFormat(pattern="yyyy-MM-dd HH-mm")
    private Date preArriveTime;;//预达
    @Column(
            name = "real_arrive_time",
            length = 30
    )
    @DateTimeFormat(pattern="yyyy-MM-dd HH-mm")
    private Date realArriveTime;//实达
    @Column(
            name = "security_state",
            length = 30
    )
    private String securityState;//保障状态
    @Column(
            name = "plane_property",
            length = 30
    )

    private String planeProperty;//航班性质
    @Column(
            name = "normal_abnormality",
            length = 30
    )

    private String normalAbnormality;//航班性质(加班，正常，异常)
    @Column(
            name = "estimated_time"

    )
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="Asia/Shanghai")
    @Temporal(TemporalType.DATE)
    private Date estimatedTime;//预计安排时间

    @Column(
            name = "flight_state",
            length = 30
    )

    private String flightState;//航班状态
    @Column(
            name = "gate_position",
            length = 30
    )
    private String gatePosition;//机位
    @Column(
            name = "camera_state",
            length = 30
    )
    private String cameraState;//机位状态
    @Column(
            name = "departure_gate",
            length = 30
    )
    private String departureGate;//登机口
    @Column(
            name = "is_delay",
            length = 30
    )
    private String isDelay;//是否延误
    @Column(
            name = "delay_reason",
            length = 30
    )
    private String delayReason;//延误原因
    /*保障进程监控所添加的字段*/
    @Column(
            name = "is_remote_gate_position",
            length = 30
    )
    private String isRemotegatePosition;//是否远机位
    @Column(
            name = "is_change_message",
            length = 30
    )
    private String isChangeMessage;//是否更换信息
    @Column(
            name = "boarding_gate_done",
            length = 30
    )
    private String boardingGateDone;//登机口到位
    @Column(
            name = "apron_done",
            length = 30
    )
    private String apronDone;//机坪到位
    @Column(
            name = "boarding_begin",
            length = 30
    )
    private String boardingBegin; //登机开始
    @Column(
            name = "close_cabinDoor",
            length = 30
    )
    private String closeCabinDoor;//关闭舱门
    @Column(
            name = "boarding_gate_free",
            length = 30
    )
    private String boardingGateFree;//登机口释放
    @Column(
            name = "apron_crew_free",
            length = 30
    )
    private String apronCrewFree;//机坪人员释放
    @Column(
            name = "flight_land",
            length = 30
    )
    private String flightLand;//航班落地
    @Column(
            name = "drop_off_end",
            length = 30
    )
    private String dropOffEnd;//下客结束




    public String getFlightLand() {
        return flightLand;
    }

    public void setFlightLand(String flightLand) {
        this.flightLand = flightLand;
    }

    public String getDropOffEnd() {
        return dropOffEnd;
    }

    public void setDropOffEnd(String dropOffEnd) {
        this.dropOffEnd = dropOffEnd;
    }

    public String getIsRemotegatePosition() {
        return isRemotegatePosition;
    }

    public void setIsRemotegatePosition(String isRemotegatePosition) {
        this.isRemotegatePosition = isRemotegatePosition;
    }

    public String getIsChangeMessage() {
        return isChangeMessage;
    }

    public void setIsChangeMessage(String isChangeMessage) {
        this.isChangeMessage = isChangeMessage;
    }

    public String getBoardingGateDone() {
        return boardingGateDone;
    }

    public void setBoardingGateDone(String boardingGateDone) {
        this.boardingGateDone = boardingGateDone;
    }

    public String getApronDone() {
        return apronDone;
    }

    public void setApronDone(String apronDone) {
        this.apronDone = apronDone;
    }

    public String getBoardingBegin() {
        return boardingBegin;
    }

    public void setBoardingBegin(String boardingBegin) {
        this.boardingBegin = boardingBegin;
    }

    public String getCloseCabinDoor() {
        return closeCabinDoor;
    }

    public void setCloseCabinDoor(String closeCabinDoor) {
        this.closeCabinDoor = closeCabinDoor;
    }

    public String getBoardingGateFree() {
        return boardingGateFree;
    }

    public void setBoardingGateFree(String boardingGateFree) {
        this.boardingGateFree = boardingGateFree;
    }

    public String getApronCrewFree() {
        return apronCrewFree;
    }

    public void setApronCrewFree(String apronCrewFree) {
        this.apronCrewFree = apronCrewFree;
    }

    public String getAirRouteNature() {
        return airRouteNature;
    }

    public void setAirRouteNature(String airRouteNature) {
        this.airRouteNature = airRouteNature;
    }

    public String getTransit() {
        return transit;
    }

    public void setTransit(String transit) {
        this.transit = transit;
    }
    @JsonFormat(pattern="yyyy-MM-dd HH:mm",timezone="Asia/Shanghai")
    public Date getPreFlyTime() {
        return preFlyTime;
    }

    public void setPreFlyTime(Date preFlyTime) {
        this.preFlyTime = preFlyTime;
    }
    @JsonFormat(pattern="yyyy-MM-dd HH:mm",timezone="Asia/Shanghai")
    public Date getRealFlyTime() {
        return realFlyTime;
    }

    public void setRealFlyTime(Date realFlyTime) {
        this.realFlyTime = realFlyTime;
    }
    @JsonFormat(pattern="yyyy-MM-dd HH:mm",timezone="Asia/Shanghai")
    public Date getPreArriveTime() {
        return preArriveTime;
    }

    public void setPreArriveTime(Date preArriveTime) {
        this.preArriveTime = preArriveTime;
    }
    @JsonFormat(pattern="yyyy-MM-dd HH:mm",timezone="Asia/Shanghai")
    public Date getRealArriveTime() {
        return realArriveTime;
    }

    public void setRealArriveTime(Date realArriveTime) {
        this.realArriveTime = realArriveTime;
    }

    public String getSecurityState() {
        return securityState;
    }

    public void setSecurityState(String securityState) {
        this.securityState = securityState;
    }

    public String getFlightState() {
        return flightState;
    }

    public void setFlightState(String flightState) {
        this.flightState = flightState;
    }

    public String getGatePosition() {
        return gatePosition;
    }

    public void setGatePosition(String gatePosition) {
        this.gatePosition = gatePosition;
    }

    public String getDepartureGate() {
        return departureGate;
    }

    public void setDepartureGate(String departureGate) {
        this.departureGate = departureGate;
    }

    public String getIsDelay() {
        return isDelay;
    }

    public void setIsDelay(String isDelay) {
        this.isDelay = isDelay;
    }


    public String getCameraState() {
        return cameraState;
    }

    public void setCameraState(String cameraState) {
        this.cameraState = cameraState;
    }


    public Boolean getTemplatePlane() {
        return templatePlane;
    }

    public void setTemplatePlane(Boolean templatePlane) {
        this.templatePlane = templatePlane;
    }

    public String getPlaneProperty() {
        return planeProperty;
    }

    public void setPlaneProperty(String planeProperty) {
        this.planeProperty = planeProperty;
    }

    public Date getEstimatedTime() {
        return estimatedTime;
    }

    public void setEstimatedTime(Date estimatedTime) {
        this.estimatedTime = estimatedTime;
    }

    public String getNormalAbnormality() {
        return normalAbnormality;
    }

    public void setNormalAbnormality(String normalAbnormality) {
        this.normalAbnormality = normalAbnormality;
    }

    public String getDelayReason() {
        return delayReason;
    }

    public void setDelayReason(String delayReason) {
        this.delayReason = delayReason;
    }

    public Integer getPlaneRunStatus() {
        return planeRunStatus;
    }

    public void setPlaneRunStatus(Integer planeRunStatus) {
        this.planeRunStatus = planeRunStatus;
    }

    public Set<CourseNodePo> getCourseNodePos() {
        return (Set<CourseNodePo>) Loaded.loaded(courseNodePos);
    }

    public void setCourseNodePos(Set<CourseNodePo> courseNodePos) {
        this.courseNodePos = courseNodePos;
    }

    public Integer getProcessStatus() {
        return processStatus;
    }

    public void setProcessStatus(Integer processStatus) {
        this.processStatus = processStatus;
    }
}
